package com.twu.biblioteca;

import org.springframework.stereotype.Component;

@Component
public class LibraryId {

    private int seed = 1111110;

    public String generate() throws LibraryIdOverflow {
        seed++;
        if (seed > 9999999)
            throw new LibraryIdOverflow();
        return String.valueOf(seed).substring(0,3) + "-" + String.valueOf(seed).substring(3,7);
    }
}
